package com.training.java.core.collections.TreeSet;

public class Car implements Comparable<Car> {
	private String make;
	private String model;
	private int year;
	private double price;

	public Car(String make, String model, int year, int price) {

		this.make = make;
		this.model = model;
		this.year = year;
		this.price = price;

	}

	public String getMake() {
		return make;
	}

	public String getModel() {
		return model;
	}

	public int getYear() {
		return year;
	}

	public double getPrice() {
		return price;
	}

	@Override
	public boolean equals(Object obj) {
		Car that = (Car) obj;

		if (this.getMake().equals(that.getMake())
				&& this.getModel().equals(that.getModel())
				&& this.getYear() == (that.getYear()))

			return true;

		else
			return false;
	}

	@Override
	public int hashCode() {
		return (this.getMake().hashCode());
	}

	@Override
	public int compareTo(Car that) {
		return this.make.compareTo(that.make);
	}
}
